<!DOCTYPE html>
<!-- saved from url=(0041)http://c.biancheng.net/view/vip_7058.html -->
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript" async="" charset="utf-8" src="./7.9Java中数组和字符串的相互转换_files/core.php"></script><script async="" src="./7.9Java中数组和字符串的相互转换_files/click.php"></script>

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<!-- 启用Chromium高速渲染模式 -->
<meta name="renderer" content="webkit">
<meta name="force-rendering" content="webkit">
<!-- 禁止百度转码 -->
<meta name="applicable-device" content="pc,mobile">
<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
<!-- 禁止识别电话号码 -->
<meta name="format-detection" content="telephone=no">

<link rel="shortcut icon" href="http://c.biancheng.net/favicon.ico?v=1.6.72">
<link href="./7.9Java中数组和字符串的相互转换_files/common.css" rel="stylesheet">
<title>Java中数组和字符串的相互转换</title>
<meta name="description" content="教程前面我们学习了 Java 中 字符串 的使用，本节我们来学习字符串和数组之间的相互转换。 字符串转换为数组 1）Java String 类中的 toCharArray() 方法将字符串转换为字符数组，具体代码如">
</head>
<body>
<div id="topbar" class="clearfix">
	<ul id="product-type" class="left">
		<li>
			<a href="http://c.biancheng.net/"><span class="iconfont iconfont-home"></span>首页</a>
		</li>
		<li class="active">
			<a href="http://c.biancheng.net/sitemap/" rel="nofollow"><span class="iconfont iconfont-book"></span>教程</a>
		</li>
		<li>
			<a href="http://vip.biancheng.net/p/vip/show.php" rel="nofollow" target="_blank"><span class="iconfont iconfont-vip"></span>VIP会员</a>
		</li>
		<li>
			<a href="http://vip.biancheng.net/p/q2a/show.php" rel="nofollow" target="_blank"><span class="iconfont iconfont-q2a"></span>一对一答疑</a>
		</li>
		<li>
			<a href="http://fudao.biancheng.net/" rel="nofollow" target="_blank"><span class="iconfont iconfont-fudao"></span>辅导班</a>
		</li>
	</ul>
</div>
<div id="header" class="clearfix">
	<a id="logo" class="left" href="http://c.biancheng.net/">
		<img height="26" src="./7.9Java中数组和字符串的相互转换_files/logo.png" alt="C语言中文网">
	</a>
	<ul id="nav-main" class="hover-none left clearfix">
		<li class="wap-yes"><a href="http://c.biancheng.net/">首页</a></li>
		<li><a href="http://c.biancheng.net/c/">C语言教程</a></li>
		<li><a href="http://c.biancheng.net/cplus/">C++教程</a></li>
		<li><a href="http://c.biancheng.net/python/">Python教程</a></li>
		<li><a href="http://c.biancheng.net/java/">Java教程</a></li>
		<li><a href="http://c.biancheng.net/linux_tutorial/">Linux入门</a></li>
		<li><a href="http://c.biancheng.net/sitemap/" title="网站地图">更多&gt;&gt;</a></li>
	</ul>
	<span id="sidebar-toggle" class="toggle-btn" toggle-target="#sidebar">目录 <span class="glyphicon"></span></span>

	<a href="http://vip.biancheng.net/?from=topbar" class="user-info glyphicon glyphicon-user hover-none" target="_blank" rel="nofollow" title="用户中心"></a>
</div>
<div id="main" class="clearfix">
	<div id="sidebar" class="toggle-target">
	<div id="contents">
		<dt><span class="glyphicon glyphicon-option-vertical" aria-hidden="true"></span><a href="http://c.biancheng.net/java/">Java教程</a></dt>
		
			<dd>
				<span class="channel-num">1</span>
				<a href="http://c.biancheng.net/java/10/">Java入门基础及环境搭建</a>
			</dd>
		
			<dd>
				<span class="channel-num">2</span>
				<a href="http://c.biancheng.net/java/20/">Java程序设计基础</a>
			</dd>
		
			<dd>
				<span class="channel-num">3</span>
				<a href="http://c.biancheng.net/java/30/">Java流程控制语句</a>
			</dd>
		
			<dd>
				<span class="channel-num">4</span>
				<a href="http://c.biancheng.net/java/40/">Java字符串处理</a>
			</dd>
		
			<dd>
				<span class="channel-num">5</span>
				<a href="http://c.biancheng.net/java/50/">Java数字和日期处理</a>
			</dd>
		
			<dd>
				<span class="channel-num">6</span>
				<a href="http://c.biancheng.net/java/60/">Java内置包装类</a>
			</dd>
		<dd class="this"> <span class="channel-num">7</span> <a href="http://c.biancheng.net/java/70/">Java数组处理</a> </dd><dl class="dl-sub"><dd>7.1 <a href="http://c.biancheng.net/view/906.html">Java数组简介</a></dd><dd>7.2 <a href="http://c.biancheng.net/view/5852.html">Java一维数组</a></dd><dd>7.3 <a href="http://c.biancheng.net/view/5857.html">Java二维数组</a></dd><dd>7.4 <a href="http://c.biancheng.net/view/917.html">Java多维数组</a></dd><dd>7.5 <a href="http://c.biancheng.net/view/5863.html">Java不规则数组</a></dd><dd>7.6 <a href="http://c.biancheng.net/view/5843.html">Java数组也是一种数据类型</a></dd><dd>7.7 <a href="http://c.biancheng.net/view/vip_7057.html">Java中到底有没有多维数组（长篇神文）？</a><span class="glyphicon glyphicon-usd"></span></dd><dd>7.8 <a href="http://c.biancheng.net/view/5885.html">Java Arrays工具类</a></dd><dd class="active">7.9 <a href="http://c.biancheng.net/view/vip_7058.html">Java中数组和字符串的相互转换</a><span class="glyphicon glyphicon-usd"></span></dd><dd>7.10 <a href="http://c.biancheng.net/view/919.html">Java比较数组</a></dd><dd>7.11 <a href="http://c.biancheng.net/view/921.html">Java数组填充</a></dd><dd>7.12 <a href="http://c.biancheng.net/view/923.html">Java数组查找指定元素</a></dd><dd>7.13 <a href="http://c.biancheng.net/view/924.html">Java复制数组</a></dd><dd>7.14 <a href="http://c.biancheng.net/view/925.html">Java sort()数组排序</a></dd><dd>7.15 <a href="http://c.biancheng.net/view/927.html">Java冒泡排序法</a></dd><dd>7.16 <a href="http://c.biancheng.net/view/929.html">Java快速排序法</a></dd><dd>7.17 <a href="http://c.biancheng.net/view/930.html">Java选择排序法</a></dd><dd>7.18 <a href="http://c.biancheng.net/view/931.html">Java直接插入排序法</a></dd><dd>7.19 <a href="http://c.biancheng.net/view/5891.html">对Java数组的总结</a></dd><dd>7.20 <a href="http://c.biancheng.net/view/5855.html">Java求数组元素的最大和最小值</a></dd><dd>7.21 <a href="http://c.biancheng.net/view/vip_7059.html">【Java项目实战】数字转人民币读法</a><span class="glyphicon glyphicon-usd"></span></dd><dd>7.22 <a href="http://c.biancheng.net/view/915.html">Java统计商品信息</a></dd><dd>7.23 <a href="http://c.biancheng.net/view/933.html">Java商品信息查询</a></dd><dd>7.24 <a href="http://c.biancheng.net/view/vip_7060.html">【Java项目实战】输出杨辉三角形（使用二维数组）</a><span class="glyphicon glyphicon-usd"></span></dd><dd>7.25 <a href="http://c.biancheng.net/view/vip_7061.html">【Java项目实战】五子棋游戏</a><span class="glyphicon glyphicon-usd"></span></dd></dl>
			<dd>
				<span class="channel-num">8</span>
				<a href="http://c.biancheng.net/java/80/">Java类和对象</a>
			</dd>
		
			<dd>
				<span class="channel-num">9</span>
				<a href="http://c.biancheng.net/java/90/">Java继承和多态</a>
			</dd>
		
			<dd>
				<span class="channel-num">10</span>
				<a href="http://c.biancheng.net/java/100/">Java异常处理</a>
			</dd>
		
			<dd>
				<span class="channel-num">11</span>
				<a href="http://c.biancheng.net/java/110/">Java集合、泛型和枚举</a>
			</dd>
		
			<dd>
				<span class="channel-num">12</span>
				<a href="http://c.biancheng.net/java/120/">Java反射机制</a>
			</dd>
		
			<dd>
				<span class="channel-num">13</span>
				<a href="http://c.biancheng.net/java/130/">Java输入/输出流</a>
			</dd>
		
			<dd>
				<span class="channel-num">14</span>
				<a href="http://c.biancheng.net/java/java/135/">Java注解</a>
			</dd>
		
	</div>
</div>
	<div id="article-wrap">
		<div id="article">
			<div class="arc-info">
	<span class="position"><span class="glyphicon glyphicon-map-marker"></span> <a href="http://c.biancheng.net/">首页</a> &gt; <a href="http://c.biancheng.net/java/">Java教程</a> &gt; <a href="http://c.biancheng.net/java/70/">Java数组处理</a></span>
	<span class="read-num">阅读：5,772</span>
</div>

<div id="ad-position-bottom"></div>
			<h1>Java中数组和字符串的相互转换</h1>
			<div class="pre-next-page clearfix">
                    <span class="pre left"><span class="icon">&lt;</span> <span class="text-brief text-brief-pre">上一页</span><a href="http://c.biancheng.net/view/5885.html">Java Arrays工具类</a></span>
                    <span class="next right"><a href="http://c.biancheng.net/view/919.html">Java比较数组</a><span class="text-brief text-brief-next">下一页</span> <span class="icon">&gt;</span></span>
                </div>
			<div id="ad-arc-top"><p class="pic"></p><p class="text" adid="java-1v1q2a"><a href="http://c.biancheng.net/view/7552.html" target="_blank" style="color: #D33428;">C语言中文网推出辅导班啦，包括<span style="color: #008000;">「C语言辅导班、C++辅导班、算法/数据结构辅导班」</span>，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践 + 永久学习。QQ在线，随时响应！</a></p></div>
			<div id="arc-body">教程前面我们学习了 Java 中<a href="http://c.biancheng.net/java/40/" target="_blank">字符串</a>的使用，本节我们来学习字符串和数组之间的相互转换。
<h2>
	字符串转换为数组</h2>
1）Java String 类中的 toCharArray() 方法将字符串转换为字符数组，具体代码如下所示。
<div class="snippet-container" style="undefined;"><div class="sh_bright snippet-wrap"><div class="snippet-menu sh_sourceCode" style="display: none;"><pre><a class="snippet-copy sh_url" href="http://c.biancheng.net/view/vip_7058.html#" style="display: none;">复制</a><a class="snippet-text sh_url" href="http://c.biancheng.net/view/vip_7058.html#">纯文本</a><a class="snippet-window sh_url" href="http://c.biancheng.net/view/vip_7058.html#">复制</a></pre></div><pre class="java sh_java snippet-formatted sh_sourceCode"><ol class="snippet-num"><li><span class="sh_usertype">String</span><span class="sh_normal"> </span>str <span class="sh_symbol">=</span> <span class="sh_string">"123abc"</span><span class="sh_symbol">;</span></li><li><span class="sh_type">char</span><span class="sh_symbol">[]</span> arr <span class="sh_symbol">=</span> str<span class="sh_symbol">.</span><span class="sh_function">toCharArray</span><span class="sh_symbol">();</span>    <span class="sh_comment">// char数组</span></li><li><span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> i <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> i <span class="sh_symbol">&lt;</span> arr<span class="sh_symbol">.</span>length<span class="sh_symbol">;</span> i<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>    System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span>arr<span class="sh_symbol">[</span>i<span class="sh_symbol">]);</span>    <span class="sh_comment">// 输出1 2 3 a b c</span></li><li><span class="sh_cbracket">}</span></li></ol></pre><pre class="snippet-textonly sh_sourceCode" style="display:none;">String str = "123abc";
char[] arr = str.toCharArray();    // char数组
for (int i = 0; i &lt; arr.length; i++) {
    System.out.println(arr[i]);    // 输出1 2 3 a b c
}</pre></div></div>
2）Java.lang 包中有 String.split() 方法，Java 中通常用 split() 分割字符串，返回的是一个数组。
<div class="snippet-container" style="undefined;"><div class="sh_bright snippet-wrap"><div class="snippet-menu sh_sourceCode" style="display: none;"><pre><a class="snippet-copy sh_url" href="http://c.biancheng.net/view/vip_7058.html#" style="display: none;">复制</a><a class="snippet-text sh_url" href="http://c.biancheng.net/view/vip_7058.html#">纯文本</a><a class="snippet-window sh_url" href="http://c.biancheng.net/view/vip_7058.html#">复制</a></pre></div><pre class="java sh_java snippet-formatted sh_sourceCode"><ol class="snippet-num"><li><span class="sh_usertype">String</span><span class="sh_normal"> </span>str <span class="sh_symbol">=</span> <span class="sh_string">"123abc"</span><span class="sh_symbol">;</span></li><li>String<span class="sh_symbol">[]</span> arr <span class="sh_symbol">=</span> str<span class="sh_symbol">.</span><span class="sh_function">split</span><span class="sh_symbol">(</span><span class="sh_string">""</span><span class="sh_symbol">);</span></li><li><span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> i <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> i <span class="sh_symbol">&lt;</span> arr<span class="sh_symbol">.</span>length<span class="sh_symbol">;</span> i<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span> <span class="sh_comment">// String数组</span></li><li>    System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">print</span><span class="sh_symbol">(</span>arr<span class="sh_symbol">[</span>i<span class="sh_symbol">]);</span> <span class="sh_comment">// 输出 1 2 3 a b c</span></li><li><span class="sh_cbracket">}</span></li></ol></pre><pre class="snippet-textonly sh_sourceCode" style="display:none;">String str = "123abc";
String[] arr = str.split("");
for (int i = 0; i &lt; arr.length; i++) { // String数组
    System.out.print(arr[i]); // 输出 1 2 3 a b c
}</pre></div></div>
使用 split() 方法注意如下：
<ul>
	<li>
		如果用“.”或“|”作为分隔的话，必须是如下写法，String.split("\.") 或 String.split("\|")，这样才能正确的分隔开，不能用 String.split(".") 或 String.split("|")。</li>
	<li>
		如果在一个字符串中有多个分隔符，可以用“|”作为连字符，如“acount=? and uu =? or n=?”，把三个都分隔出来，可以用 String.split(“and|or”);</li>
	<li>
		如果想在串中使用“”字符，则也需要转义。首先要表达“aaaa\bbbb”这个串就应该用"aaaa\bbbb”，这样分隔才能得到正确结果。</li>
</ul>
<br>
3）如果要返回 byte 数组就直接使用 getBytes 方法就可以了。
<p class="info-box">
	String str = "123abc" ;<br>
	byte [] arr = str.getBytes();</p>
4）使用 StringUtils 中的 join 函数，使用前需先引入 common-lang3 的 jar 包，可去 <a href="https://commons.apache.org/proper/commons-lang/download_lang.cgi" target="_blank">apache 官网</a>下载，代码如下所示。
<div class="snippet-container" style="undefined;"><div class="sh_bright snippet-wrap"><div class="snippet-menu sh_sourceCode" style="display:none;"><pre><a class="snippet-copy sh_url" href="http://c.biancheng.net/view/vip_7058.html#" style="display: none;">复制</a><a class="snippet-text sh_url" href="http://c.biancheng.net/view/vip_7058.html#">纯文本</a><a class="snippet-window sh_url" href="http://c.biancheng.net/view/vip_7058.html#">复制</a></pre></div><pre class="java sh_java snippet-formatted sh_sourceCode"><ol class="snippet-num"><li>StringUtils<span class="sh_symbol">.</span><span class="sh_function">join</span><span class="sh_symbol">(</span><span class="sh_keyword">null</span><span class="sh_symbol">)</span> <span class="sh_symbol">=</span> <span class="sh_keyword">null</span><span class="sh_symbol">;</span></li><li>StringUtils<span class="sh_symbol">.</span><span class="sh_function">join</span><span class="sh_symbol">([])</span> <span class="sh_symbol">=</span> <span class="sh_string">""</span><span class="sh_symbol">;</span></li><li>StringUtils<span class="sh_symbol">.</span><span class="sh_function">join</span><span class="sh_symbol">([</span><span class="sh_keyword">null</span><span class="sh_symbol">])=</span> <span class="sh_string">""</span><span class="sh_symbol">;</span></li><li>StringUtils<span class="sh_symbol">.</span><span class="sh_function">join</span><span class="sh_symbol">([</span><span class="sh_string">"a"</span><span class="sh_symbol">,</span> <span class="sh_string">"b"</span><span class="sh_symbol">,</span> <span class="sh_string">"c"</span><span class="sh_symbol">])</span> <span class="sh_symbol">=</span> <span class="sh_string">"abc"</span><span class="sh_symbol">;</span></li><li>StringUtils<span class="sh_symbol">.</span><span class="sh_function">join</span><span class="sh_symbol">([</span><span class="sh_keyword">null</span><span class="sh_symbol">,</span> <span class="sh_string">""</span><span class="sh_symbol">,</span> <span class="sh_string">"a"</span><span class="sh_symbol">])</span> <span class="sh_symbol">=</span> <span class="sh_string">"a"</span><span class="sh_symbol">;</span></li><li>String<span class="sh_symbol">[]</span> str <span class="sh_symbol">=</span> <span class="sh_cbracket">{</span> <span class="sh_string">"1"</span><span class="sh_symbol">,</span> <span class="sh_string">"2"</span><span class="sh_symbol">,</span> <span class="sh_string">"a"</span><span class="sh_symbol">,</span> <span class="sh_string">"b"</span> <span class="sh_cbracket">}</span><span class="sh_symbol">;</span></li><li><span class="sh_comment">// 将数组变成字符串</span></li><li>StringUtils<span class="sh_symbol">.</span><span class="sh_function">join</span><span class="sh_symbol">(</span>str<span class="sh_symbol">);</span></li><li><span class="sh_comment">// 将数组用逗号分隔变成字符串</span></li><li>StringUtils<span class="sh_symbol">.</span><span class="sh_function">join</span><span class="sh_symbol">(</span>str<span class="sh_symbol">,</span> <span class="sh_string">","</span><span class="sh_symbol">);</span></li></ol></pre><pre class="snippet-textonly sh_sourceCode" style="display:none;">StringUtils.join(null) = null;
StringUtils.join([]) = "";
StringUtils.join([null])= "";
StringUtils.join(["a", "b", "c"]) = "abc";
StringUtils.join([null, "", "a"]) = "a";
String[] str = { "1", "2", "a", "b" };
// 将数组变成字符串
StringUtils.join(str);
// 将数组用逗号分隔变成字符串
StringUtils.join(str, ",");</pre></div></div>
<h2>
	数组转换为字符串</h2>
1）char 字符数组转化为字符串，使用 String.copyValueOf(charArray) 函数实现，具体代码如下所示。
<div class="snippet-container" style="undefined;"><div class="sh_bright snippet-wrap"><div class="snippet-menu sh_sourceCode" style="display:none;"><pre><a class="snippet-copy sh_url" href="http://c.biancheng.net/view/vip_7058.html#" style="display: none;">复制</a><a class="snippet-text sh_url" href="http://c.biancheng.net/view/vip_7058.html#">纯文本</a><a class="snippet-window sh_url" href="http://c.biancheng.net/view/vip_7058.html#">复制</a></pre></div><pre class="java sh_java snippet-formatted sh_sourceCode"><ol class="snippet-num"><li><span class="sh_type">char</span><span class="sh_symbol">[]</span> arr <span class="sh_symbol">=</span> <span class="sh_cbracket">{</span> <span class="sh_string">'a'</span><span class="sh_symbol">,</span> <span class="sh_string">'b'</span><span class="sh_symbol">,</span> <span class="sh_string">'c'</span> <span class="sh_cbracket">}</span><span class="sh_symbol">;</span></li><li><span class="sh_usertype">String</span><span class="sh_normal"> </span>string <span class="sh_symbol">=</span> String<span class="sh_symbol">.</span><span class="sh_function">copyValueOf</span><span class="sh_symbol">(</span>arr<span class="sh_symbol">);</span></li><li>System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span>string<span class="sh_symbol">);</span> <span class="sh_comment">// 输出abc</span></li></ol></pre><pre class="snippet-textonly sh_sourceCode" style="display:none;">char[] arr = { 'a', 'b', 'c' };
String string = String.copyValueOf(arr);
System.out.println(string); // 输出abc</pre></div></div>
2）String 字符串数组转化为字符串，代码如下所示。
<div class="snippet-container" style="undefined;"><div class="sh_bright snippet-wrap"><div class="snippet-menu sh_sourceCode" style="display:none;"><pre><a class="snippet-copy sh_url" href="http://c.biancheng.net/view/vip_7058.html#" style="display: none;">复制</a><a class="snippet-text sh_url" href="http://c.biancheng.net/view/vip_7058.html#">纯文本</a><a class="snippet-window sh_url" href="http://c.biancheng.net/view/vip_7058.html#">复制</a></pre></div><pre class="java sh_java snippet-formatted sh_sourceCode"><ol class="snippet-num"><li>String<span class="sh_symbol">[]</span> arr <span class="sh_symbol">=</span> <span class="sh_cbracket">{</span> <span class="sh_string">"123"</span><span class="sh_symbol">,</span> <span class="sh_string">"abc"</span> <span class="sh_cbracket">}</span><span class="sh_symbol">;</span></li><li><span class="sh_usertype">StringBuffer</span><span class="sh_normal"> </span>sb <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_function">StringBuffer</span><span class="sh_symbol">();</span></li><li><span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_type">int</span> i <span class="sh_symbol">=</span> <span class="sh_number">0</span><span class="sh_symbol">;</span> i <span class="sh_symbol">&lt;</span> arr<span class="sh_symbol">.</span>length<span class="sh_symbol">;</span> i<span class="sh_symbol">++)</span> <span class="sh_cbracket">{</span></li><li>    sb<span class="sh_symbol">.</span><span class="sh_function">append</span><span class="sh_symbol">(</span>arr<span class="sh_symbol">[</span>i<span class="sh_symbol">]);</span> <span class="sh_comment">// String并不拥有append方法，所以借助 StringBuffer</span></li><li><span class="sh_cbracket">}</span></li><li><span class="sh_usertype">String</span><span class="sh_normal"> </span>sb1 <span class="sh_symbol">=</span> sb<span class="sh_symbol">.</span><span class="sh_function">toString</span><span class="sh_symbol">();</span></li><li>System<span class="sh_symbol">.</span>out<span class="sh_symbol">.</span><span class="sh_function">println</span><span class="sh_symbol">(</span>sb1<span class="sh_symbol">);</span> <span class="sh_comment">// 输出123abc</span></li></ol></pre><pre class="snippet-textonly sh_sourceCode" style="display:none;">String[] arr = { "123", "abc" };
StringBuffer sb = new StringBuffer();
for (int i = 0; i &lt; arr.length; i++) {
    sb.append(arr[i]); // String并不拥有append方法，所以借助 StringBuffer
}
String sb1 = sb.toString();
System.out.println(sb1); // 输出123abc</pre></div></div>
</div>
			<div id="arc-append">
	<p>关注微信公众号「站长严长生」，在手机上阅读所有教程，随时随地都能学习。本公众号由<a class="col-link" href="http://c.biancheng.net/view/8092.html" target="_blank" rel="nofollow">C语言中文网站长</a>运营，每日更新，坚持原创，敢说真话，凡事有态度。</p>
	<p style="margin-top:12px; text-align:center;">
		<img width="180" src="./7.9Java中数组和字符串的相互转换_files/qrcode_weixueyuan_original.png" alt="魏雪原二维码"><br>
		<span class="col-green">微信扫描二维码关注公众号</span>
	</p>
</div>
<!-- <p>关注微信公众号「魏雪原」，跟着<a class="col-link" href="/view/8092.html" target="_blank">站长</a>一起学习，拒绝躺平，跳出内卷，用知识完成阶级跃升：</p>
	<ul>
		<li>每日更新，坚持原创，敢说真话，凡事有态度。</li>
		<li>编程+求职+创业+营销，既有硬知识，也有软技能。</li>
		<li>手机端阅读教程，随时随地都能学习。</li>
		<li>即将绑定网站部分功能，包括注册登录、找回密码、获取下载链接等。</li>
	</ul> -->
			<div class="pre-next-page clearfix">
                    <span class="pre left"><span class="icon">&lt;</span> <span class="text-brief text-brief-pre">上一页</span><a href="http://c.biancheng.net/view/5885.html">Java Arrays工具类</a></span>
                    <span class="next right"><a href="http://c.biancheng.net/view/919.html">Java比较数组</a><span class="text-brief text-brief-next">下一页</span> <span class="icon">&gt;</span></span>
                </div>
			<div id="ad-arc-bottom"></div>

<!-- <div id="ad-bottom-weixin" class="clearfix">
	<div class="left" style="width: 535px;">
		<p><span class="col-red">编程帮</span>，一个分享编程知识的公众号。跟着<a class="col-link" href="/cpp/about/author/" target="_blank">站长</a>一起学习，每天都有进步。</p>
		<p>通俗易懂，深入浅出，一篇文章只讲一个知识点。</p>
		<p>文章不深奥，不需要钻研，在公交、在地铁、在厕所都可以阅读，随时随地涨姿势。</p>
		<p>文章不涉及代码，不烧脑细胞，人人都可以学习。</p>
		<p>当你决定关注「编程帮」，你已然超越了90%的程序员！</p>
	</div>
	<div class="right" style="width: 150px;">
		<img width="150" src="/templets/new/images/erweima_biancheng.gif?v=1.6.72" alt="编程帮二维码" /><br />
		<span class="col-green">微信扫描二维码关注</span>
	</div>
</div> -->

<div id="nice-arcs" class="box-bottom">
	<h4>优秀文章</h4>
	<ul class="clearfix">
<li><a href="http://c.biancheng.net/view/169.html" title="C++友元函数和友元类（C++ friend）详解">C++友元函数和友元类（C++ friend）详解</a></li>
<li><a href="http://c.biancheng.net/view/613.html" title="C++ move(STL move)函数使用详解">C++ move(STL move)函数使用详解</a></li>
<li><a href="http://c.biancheng.net/view/980.html" title="Java析构方法">Java析构方法</a></li>
<li><a href="http://c.biancheng.net/view/1980.html" title="C语言#define的用法，C语言宏定义">C语言#define的用法，C语言宏定义</a></li>
<li><a href="http://c.biancheng.net/view/vip_2220.html" title="C++函数编译原理和成员函数的实现">C++函数编译原理和成员函数的实现</a></li>
<li><a href="http://c.biancheng.net/view/2441.html" title="MySQL外键约束（FOREIGN KEY）">MySQL外键约束（FOREIGN KEY）</a></li>
<li><a href="http://c.biancheng.net/view/5590.html" title="Python docstring（文档字符串）：给代码添加注释">Python docstring（文档字符串）：给代码添加注释</a></li>
<li><a href="http://c.biancheng.net/view/6984.html" title="C++ auto类型推导完全攻略">C++ auto类型推导完全攻略</a></li>
<li><a href="http://c.biancheng.net/view/7846.html" title="jQuery伪类选择器是什么">jQuery伪类选择器是什么</a></li>
<li><a href="http://c.biancheng.net/view/vip_8118.html" title="目前主流的Java Web开发框架，初学者一定要了解！">目前主流的Java Web开发框架，初学者一定要了解！</a></li>
</ul>
</div>
		</div>
		
	</div>
</div>
<script type="text/javascript">
// 当前文章ID
window.arcIdRaw = 'a_' + 7058;
window.arcId = "02467b5useocxVwqmW2cyD7qWoDQ1GOa3Z4M8dc3RKGY7QspzgYAQsKyGi8";
window.typeidChain = "98|79";
</script>
<div id="footer" class="clearfix">
	<div class="info left">
	<p>精美而实用的网站，分享优质编程教程，帮助有志青年。千锤百炼，只为大作；精益求精，处处斟酌；这种教程，看一眼就倾心。</p>
	<p>
		<a href="http://c.biancheng.net/view/8066.html" target="_blank" rel="nofollow">关于网站</a> <span>|</span>
		<a href="http://c.biancheng.net/view/8092.html" target="_blank" rel="nofollow">关于站长</a> <span>|</span>
		<a href="http://c.biancheng.net/view/8097.html" target="_blank" rel="nofollow">如何完成一部教程</a> <span>|</span>
		<a href="http://c.biancheng.net/view/8093.html" target="_blank" rel="nofollow">联系我们</a> <span>|</span>
		<a href="http://c.biancheng.net/sitemap/" target="_blank" rel="nofollow">网站地图</a>
	</p>
	<p>Copyright ©2012-2021 biancheng.net, <a href="http://www.beian.miit.gov.cn/" target="_blank" rel="nofollow" style="color:#666;">陕ICP备15000209号</a></p>
	</div>
	<img class="right" src="./7.9Java中数组和字符串的相互转换_files/logo_bottom.gif" alt="底部Logo">
	<span id="return-top"><b>↑</b></span>
</div>

<script type="text/javascript">
window.siteId = 4;
window.cmsTemplets = "/templets/new";
window.cmsTempletsVer = "1.6.72";
</script>

<script src="./7.9Java中数组和字符串的相互转换_files/jquery1.12.4.min.js.下载"></script>
<script src="./7.9Java中数组和字符串的相互转换_files/common.js.下载"></script>
<span style="display:none;"><script src="./7.9Java中数组和字符串的相互转换_files/z_stat.php" type="text/javascript" defer="defer" async="async"></script></span>

</body></html>